package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysCourseStudyRecordMapper;
import com.ruoyi.system.domain.SysCourseStudyRecord;
import com.ruoyi.system.service.ISysCourseStudyRecordService;
import com.ruoyi.common.core.text.Convert;

/**
 * 学习记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-26
 */
@Service
public class SysCourseStudyRecordServiceImpl implements ISysCourseStudyRecordService 
{
    @Autowired
    private SysCourseStudyRecordMapper sysCourseStudyRecordMapper;

    /**
     * 查询学习记录
     * 
     * @param id 学习记录主键
     * @return 学习记录
     */
    @Override
    public SysCourseStudyRecord selectSysCourseStudyRecordById(Long id)
    {
        return sysCourseStudyRecordMapper.selectSysCourseStudyRecordById(id);
    }

    /**
     * 查询学习记录列表
     * 
     * @param sysCourseStudyRecord 学习记录
     * @return 学习记录
     */
    @Override
    public List<SysCourseStudyRecord> selectSysCourseStudyRecordList(SysCourseStudyRecord sysCourseStudyRecord)
    {
        return sysCourseStudyRecordMapper.selectSysCourseStudyRecordList(sysCourseStudyRecord);
    }

    /**
     * 新增学习记录
     * 
     * @param sysCourseStudyRecord 学习记录
     * @return 结果
     */
    @Override
    public int insertSysCourseStudyRecord(SysCourseStudyRecord sysCourseStudyRecord)
    {
        sysCourseStudyRecord.setCreateTime(DateUtils.getNowDate());
        return sysCourseStudyRecordMapper.insertSysCourseStudyRecord(sysCourseStudyRecord);
    }

    /**
     * 修改学习记录
     * 
     * @param sysCourseStudyRecord 学习记录
     * @return 结果
     */
    @Override
    public int updateSysCourseStudyRecord(SysCourseStudyRecord sysCourseStudyRecord)
    {
        sysCourseStudyRecord.setUpdateTime(DateUtils.getNowDate());
        return sysCourseStudyRecordMapper.updateSysCourseStudyRecord(sysCourseStudyRecord);
    }

    /**
     * 批量删除学习记录
     * 
     * @param ids 需要删除的学习记录主键
     * @return 结果
     */
    @Override
    public int deleteSysCourseStudyRecordByIds(String ids)
    {
        return sysCourseStudyRecordMapper.deleteSysCourseStudyRecordByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除学习记录信息
     * 
     * @param id 学习记录主键
     * @return 结果
     */
    @Override
    public int deleteSysCourseStudyRecordById(Long id)
    {
        return sysCourseStudyRecordMapper.deleteSysCourseStudyRecordById(id);
    }
}
